package com.hailiang.saas.auth.config;

import com.hailiang.saas.auth.remote.feign.manage.UcAccountServiceApiManage;
import com.hailiang.saas.auth.remote.feign.manage.UcUserInfoServiceApiManage;
import com.hailiang.saas.auth.remote.feign.manage.UcUserRoleServiceApiManage;
import com.hailiang.saas.auth.service.JwtTokenService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;

/**
 * @author : pangfuzhong
 * @description
 * @date : 2021/9/27 11:09
 */
@Configuration
@RefreshScope
@Data
public class AuthenticationConfig {

    @Value("${login_auth_url}")
    private String loginAuthUrl;

    @Value("${logout_auth_url}")
    private String logoutAuthUrl;

    @Value("${token_auth_url}")
    private String tokenAuthUrl;

    @Value("${verification_auth_url}")
    private String verificationAuthUrl;

    @Value("${white_list_url}")
    private String whiteListUrl;

    @Value("${token_expire_time}")
    private Integer tokenExpireTime;

    @Value("${token_expire_time_unit}")
    private String tokenExpireTimeUnit;

    @Value("${saas_auth_user_token-header-name}")
    private String tokenKey;

    @Autowired
    private RestTemplate restTemplate;

    @Autowired
    private UserDetailsService userDetailsService;

    @Autowired
    private ConfigurableEnvironment configurableEnvironment;

    @Resource(name = "redisTemplateHailiang")
    private RedisTemplate redisTemplate;

    @Autowired
    private JwtTokenService jwtTokenService;

    @Autowired
    private UcAccountServiceApiManage ucAccountServiceApiManage;

    @Autowired
    private UcUserInfoServiceApiManage ucUserInfoServiceApiManage;

    @Autowired
    private UcUserRoleServiceApiManage ucUserRoleServiceApiManage;

}
